package Demo02.Demo;

import java.io.File;

public class Demo_recursion {
    public static void main(String[] args) {
        File file = new File("G:\\xiangmu\\fuxi\\fuxidemo01\\src\\demo01");
        SarvterDate(file,".java");
    }
    public static  void  SarvterDate(File file,String suffix){
        File[] files =file.listFiles();
        if (files!=null && files.length>0){
            for (File file1 :files){
                if (file1.isFile()){
                    if (file1.getName().endsWith(suffix)){
                        System.out.println(file1.getName());
                    }else {
                        SarvterDate(file1,suffix);
                    }
                }else {
                    System.out.println("集合为空");
                }
            }
        }
    }
}
